﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="ZX.Web.UI.Controls.BasePage" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>文件上传</title>
    <script src="/SFramework/miniui/swfupload/swfupload.js"></script>
</head>

<body>
  <input id="Filedata" class="mini-fileupload" name="Filedata" limitType="*.txt" 
    />
     <input type="button"  id="btnUpload" value="上传"/>
      <input type="button"  id="btnUpload2" value="上传" onclick="fnStartUpload();"/>
    
</body>
</html>
<script type="text/javascript">
    var swfu;
    window.onload = function () {
        var settings_object = {//定义参数配置对象
            upload_url: "upload.aspx?action=set&function_id=<%=GetGuidFromQueryString("function_id")%>",
            flash_url: "/SFramework/miniui/swfupload/swfupload.swf",
            file_post_name: "Filedata",
            post_params: {
                "post_param_name_1": "post_param_value_1",
                "post_param_name_2": "post_param_value_2",
                "post_param_name_n": "post_param_value_n"
            },
            use_query_string: false,
            requeue_on_error: false,
            http_success: [201, 202],
            assume_success_timeout: 0,
            file_types: "*.jpg;*.gif",
            file_types_description: "Web Image Files",
            file_size_limit: "10240",
            file_upload_limit: 10,
            file_queue_limit: 10,

            debug: false,

            prevent_swf_caching: false,
            preserve_relative_urls: false,

            button_placeholder_id: "btnUpload",
            button_image_url: "http://www.swfupload.org/button_sprite.png",
            button_width: 61,
            button_height: 22,
            button_text: "<b>上传</b> <span class=\"redText\">文件</span>",
            button_text_style: ".redText { color: #FF0000; }",
            button_text_left_padding: 3,
            button_text_top_padding: 2,
            button_action: SWFUpload.BUTTON_ACTION.SELECT_FILES,
            button_disabled: false,
            button_cursor: SWFUpload.CURSOR.HAND,
            button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,

            swfupload_loaded_handler: swfupload_loaded_function,
            file_dialog_start_handler: file_dialog_start_function,
            file_queued_handler: file_queued_function,
            file_queue_error_handler: file_queue_error_function,
            file_dialog_complete_handler: file_dialog_complete_function,
            upload_start_handler: upload_start_function,
            upload_progress_handler: upload_progress_function,
            upload_error_handler: upload_error_function,
            upload_success_handler: upload_success_function,
            upload_complete_handler: upload_complete_function,
            debug_handler: debug_function
        };

        swfu = new SWFUpload(settings_object);//实例化一个SWFUpload，传入参数配置对象
    };
    /*定义各种事件监听函数*/
    function swfupload_loaded_function(){}
    function file_dialog_start_function(){}
    function file_queued_function() { }
    function file_queue_error_function() { }
    function file_dialog_complete_function() { }
    function upload_start_function() { }
    function upload_progress_function() { }
    function upload_error_function(file, serverdata) { alert(serverdata);}
    function upload_success_function(file, serverdata) { alert(serverdata); }
    function upload_complete_function() {  }
    function debug_function() { }
    function fnStartUpload() {
        swfu.startUpload();
    };

</script>